Page({


  data:{
    "time_month" : '',
    "time_date" : '',
    "time_year" : '',
    "swi_img1" : '/images/lunbo1.jpg',
    "swi_img2" : '/images/lunbo2.jpg',
    "swi_img3" : '/images/lunbo3.jpg',
  },
  
  onLoad:function(){
    console.log('onLoad');
    var that = this;
    var time_m = new Date().getMonth();
    var time_date = new Date().getDate();
    var time_year = new Date().getFullYear();
    var time_month;
    switch ( time_m ) {
      case 0:
        time_month = 'Jan.';
        break;
      case 1:
        time_month = 'Feb.';
        break;
      case 2:
        time_month = 'Mar.';
        break;
      case 3:
        time_month = 'Apr.';
        break;
      case 4:
        time_month = 'May';
        break;
      case 5:     
        time_month = 'Jun.';
        break;
      case 6:     
        time_month = 'Jul.';
        break;
      case 7:     
        time_month = 'Aug.';
        break;
      case 8:     
        time_month = 'Sep.';
        break;
      case 9:     
        time_month = 'Oct.';
        break;
      case 10:     
        time_month = 'Nov.';
        break;
      case 11:     
        time_month = 'Dec.';
        break;
      }
    that.setData({
      time_month:time_month,
      time_date:time_date,
      time_year:time_year
    })

    var that = this;
    var odometer = this.selectComponent('#odometer');
    var rnd = that.getRandom(1, 31);
    setTimeout(function() {
        odometer.update(time_date);
    }, 550);
    setInterval(function() {
    var rnd = that.getRandom(1, 31);
        odometer.update(time_date);
    }, 1200);
},
getRandom: function(min, max) {
    return Math.round(Math.random() * (max - min) + min);

  },

onShareAppMessage: function (res) {
    return{
      title:'历史上的今天',
      path:'/pages/home/home',

      success:function(res){
        wx.showToast({
          title: '分享成功',
        })
      },
      fail:function(res){
        wx.showToast({
          title: '分享失败',
        })
      }
    }
}


})

